package com.histone.lilian.config;

import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CacheConfig {

    /**
     * 缓存用户在线状态
     * @return
     */
    @Bean
    public TimedCache<String, String> onlineUserCache() {
        TimedCache<String, String> cache = CacheUtil.newTimedCache(10 * 60 * 1000);
        cache.schedulePrune(60 * 1000);

        return cache;
    }
}
